<script type="text/javascript">
$(function () {
	$.ajaxSetup({cache: false});
	$("input[type='text']").wijtextbox();
	$("input[type='radio']").wijradio();
	queryHandle();
});

function queryHandle(page) {
	var parm = $('#queryHandleForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = '${contextPath}handle-query.html';
	sys_loading();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#resultList').html(result);
		}
	});
}

function deleteHandle(code, name) {
	ui.confirm('删除操作', '确认要删除名称为：' + name + ' 的操作吗?')
		.ok('确认删除')
		.cancel('取消')
		.show(function(ok){
			if (ok) {
				sys_submiting();
				var url = '${contextPath}handle-delete.html?time=' + getTime();
				var parm = {'code':code};
				$.ajax({type:'POST', url:url, data:parm, 
					success: function(result) {
						sys_submiting_close();
						if ('success' == result) {
							sys_msg(name + ' 操作删除成功!');
							queryHandle();
						} else {
							sys_warning('删除失败', name + ' 操作删除失败，请联系管理员!');
						}
					}
				});
			}
		});
}
</script>

<#import "/freemarker/modeltype.ftl" as mt>

<form id="queryHandleForm">
<table class="search_term_table">
	<tr>
		<th style="width: 80px;">操作名称</th>
		<td style="width: 160px;"><input type="text" name="name" /></td>
		<th style="width: 40px;">类型</th>
		<td style="width: 350px;"><@mt.HandleType r=true name='type' mc=true /></td>
		<td style="text-align: right;">
			<a href="#" class="link_btn ui-state-default ui-corner-all" onclick="javascript: queryHandle(); return false;">
				<span class="ui-icon ui-icon-search"></span>&nbsp;查&nbsp;&nbsp;询&nbsp;
			</a>&nbsp;&nbsp;
			<a href="#" class="link_btn ui-state-default ui-corner-all" onclick="javascript: loadHandlePage('handle-edit'); return false;">
				<span class="ui-icon ui-icon-newwin"></span>&nbsp;添加操作&nbsp;
			</a>
		</td>
	</tr>
</table>
</form>
<div id="resultList"></div>
